
package com.bk.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.bk.dao.CategoryDao;
import com.bk.model.Category;
import com.bk.model.Product;
import com.bk.utils.C3P0Util;

public class CategoryDaoImpl implements CategoryDao{

	@Override
	public List<Category> findAll() throws SQLException {
		QueryRunner qr=new QueryRunner(C3P0Util.getDataSource());
		
		//TODO
		return qr.query("select * from category", new BeanListHandler<>(Category.class));
			
	}
	@Override
	public List<Category> findByOthers(String sql, Object... params) throws SQLException {
		QueryRunner qr=new QueryRunner(C3P0Util.getDataSource());
		//TODO
		return qr.query(sql, new BeanListHandler<>(Category.class), params);

	}

}

	